<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
</body>
<script>
    //用push 在数组后面添加元素
    // var arr = [1,2,3];
    // arr .push(4 ,"pink");
    // console.log(arr.push(4,"pink"))     //返回值 返回的是新数组的长度
    // console.log(arr);


    function unique(arr){
        var newArr = [];
        for(var i = 0;i < arr.length; i++ ){
            if (newArr.indexOf(arr[i])=== -1){
                newArr.push(arr[i]);
            }
        }
        return newArr;
    }
    var demo = unique(["c","d","b","c","a","b"])
    console.log(demo);



    









</script>
</html>